import { validTelphone, validNumber } from '@/utils/validate'

export function validatePhone (rule, value, callback, fieldsName) {
  if (!value) {
    callback(new Error(fieldsName + '不能为空'))
  }
  if (!validTelphone(value)) {
    callback(new Error(fieldsName + '输入有误，请重新输入!'))
  }
  callback()
}

export function validateNumber (rule, value, callback, fieldsName) {
  if (!value) {
    callback(new Error(fieldsName + '不能为空'))
  }
  if (!validNumber(value)) {
    callback(new Error('输入有误，请输入阿拉伯数字!'))
  }
  callback()
}
